// src/utils/cart.js
import service from './request'

const BASE_URL = '/cart'

export function getCart() {
  return service.get(BASE_URL)
}

export function addToCart(dishId, quantity = 1) {  // 修改参数名
  return service.post(BASE_URL, { dishId, quantity }, {  // 发送dishId
    headers: { 'Content-Type': 'application/json' }
  })
}

export function deleteCartItem(id) {
  return service.delete(`${BASE_URL}/${id}`)
}

export function submitOrder() {
  return service.post(`${BASE_URL}/checkout`)
}
